
#ifndef _OLED_H_
#define _OLED_H_

#include "main.h"
#include "oledfont.h"
#include "stdio.h"

#define SCL_PIN GPIO_PIN_5
#define SDA_PIN GPIO_PIN_7
#define OLED_PORT GPIOA
#define SCL_H HAL_GPIO_WritePin(OLED_PORT,SCL_PIN,1)
#define SCL_L  HAL_GPIO_WritePin(OLED_PORT,SCL_PIN,0)
#define SDA_H  HAL_GPIO_WritePin(OLED_PORT,SDA_PIN,1)
#define SDA_L  HAL_GPIO_WritePin(OLED_PORT,SDA_PIN,0)
#define Address 0x78
#define IN 0
#define OUT 1

extern uint8_t OLED_GRAM[8][128];
extern uint8_t hour,minute;
extern uint16_t second;
extern uint8_t tf;
extern TIM_HandleTypeDef TIM4_Handler;

void OLED_GPIOSet();

void IIC_Start();
void IIC_Stop();
void OLED_WaitACK();
void OLED_WByte(uint8_t byte);
void OLED_Init();
void OLED_DelayInit();
void OLED_WCmd(uint8_t cmd);
void OLED_Clear();
void OLED_Fill(uint8_t data);
void OLED_WData(uint8_t data);
void OLED_String(uint8_t x,uint8_t y,char *str);
void OLED_ClearGRAM();
void OLED_DrawLine(uint8_t x1,uint8_t y1,uint8_t x2,uint8_t y2);
void OLED_DrawPoint(uint8_t x,uint8_t y);
void OLED_UpDateGRAM();
void OLED_Char(uint8_t x,uint8_t y,char ch);
void OLED_SetPos(uint8_t x,uint8_t y);
void OLED_Time();

void OLED_Delay(uint8_t us);





#endif
